/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * GenerarReciboPagoCuenta.java
 *
 * Created on Jan 3, 2012, 5:48:01 PM
 */

package INTERFAZ;

import CONTROLES.ControlRecibo;
import CONTROLES.ControlTipoCambio;
import FACTURAS.GenerarFactura;
import MODELOS.Cliente;
import MODELOS.Cuenta;
import MODELOS.Pago;
import MODELOS.Recibo;
import MODELOS.TipoCambio;
import Reportes.Reporte;
import UTILITARIOS.Fecha;
import UTILITARIOS.Herramienta;
import UTILITARIOS.MiModelo;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.Date;
import javax.swing.JOptionPane;
import javax.swing.SwingConstants;
import javax.swing.table.DefaultTableCellRenderer;

/**
 *
 * @author VICENTE
 */
public class GenerarReciboPagoCuenta extends javax.swing.JDialog {

    /** Creates new form GenerarReciboPagoCuenta */
    public GenerarReciboPagoCuenta(javax.swing.JDialog parent, boolean modal, Cuenta c, String modo) {
        super(parent, modal);        
        initComponents();
        
        this.cuenta = c;
        this.modo = modo;
        iniciarValores();
        addEventos(parent);
    }
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        pagos = new javax.swing.JTable();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        jLabel14 = new javax.swing.JLabel();
        jLabel15 = new javax.swing.JLabel();
        jButton1 = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        jLabel16 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jLabel17 = new javax.swing.JLabel();
        jLabel18 = new javax.swing.JLabel();
        jLabel19 = new javax.swing.JLabel();
        jButton3 = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        jLabel1.setFont(new java.awt.Font("Times New Roman", 1, 12));
        jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel1.setText("PAGO DE INTERESES");
        jLabel1.setName("jLabel1"); // NOI18N

        jLabel2.setFont(new java.awt.Font("Times New Roman", 0, 10));
        jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        jLabel2.setText("NOMBRE CLIENTE:");
        jLabel2.setName("jLabel2"); // NOI18N

        jLabel3.setFont(new java.awt.Font("Times New Roman", 0, 10));
        jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        jLabel3.setText("CUENTA N#:");
        jLabel3.setName("jLabel3"); // NOI18N

        jLabel4.setFont(new java.awt.Font("Times New Roman", 0, 10));
        jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel4.setText("PLAN:");
        jLabel4.setName("jLabel4"); // NOI18N

        jScrollPane1.setName("jScrollPane1"); // NOI18N

        pagos.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
        pagos.setName("pagos"); // NOI18N
        jScrollPane1.setViewportView(pagos);

        jLabel5.setFont(new java.awt.Font("Times New Roman", 0, 10));
        jLabel5.setText("jLabel5");
        jLabel5.setName("jLabel5"); // NOI18N

        jLabel6.setFont(new java.awt.Font("Times New Roman", 0, 10));
        jLabel6.setText("jLabel6");
        jLabel6.setName("jLabel6"); // NOI18N

        jLabel7.setFont(new java.awt.Font("Times New Roman", 0, 10));
        jLabel7.setText("jLabel7");
        jLabel7.setName("jLabel7"); // NOI18N

        jLabel8.setFont(new java.awt.Font("Times New Roman", 0, 10));
        jLabel8.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel8.setText("FECHA:");
        jLabel8.setName("jLabel8"); // NOI18N

        jLabel12.setText("T.C. Compra:");
        jLabel12.setName("jLabel12"); // NOI18N

        jLabel13.setText("6.86");
        jLabel13.setName("jLabel13"); // NOI18N

        jLabel14.setFont(new java.awt.Font("Times New Roman", 0, 12));
        jLabel14.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel14.setText("NFN Garantia y Cumplimiento");
        jLabel14.setName("jLabel14"); // NOI18N

        jLabel15.setFont(new java.awt.Font("Times New Roman", 0, 12));
        jLabel15.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel15.setText("Gracias por confiar en Nosotros");
        jLabel15.setName("jLabel15"); // NOI18N

        jButton1.setText("Pagar e Imprimir Recibo");
        jButton1.setName("jButton1"); // NOI18N
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jButton2.setText("Salir");
        jButton2.setName("jButton2"); // NOI18N

        jLabel16.setFont(new java.awt.Font("Times New Roman", 0, 10));
        jLabel16.setText("jLabel16");
        jLabel16.setName("jLabel16"); // NOI18N

        jLabel9.setFont(new java.awt.Font("Times New Roman", 0, 10));
        jLabel9.setText("MONTO INVERSION:");
        jLabel9.setName("jLabel9"); // NOI18N

        jLabel17.setFont(new java.awt.Font("Times New Roman", 0, 10));
        jLabel17.setText("jLabel17");
        jLabel17.setName("jLabel17"); // NOI18N

        jLabel18.setFont(new java.awt.Font("Times New Roman", 1, 12));
        jLabel18.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel18.setText("NFN Inversiones");
        jLabel18.setName("jLabel18"); // NOI18N

        jLabel19.setFont(new java.awt.Font("Times New Roman", 1, 12));
        jLabel19.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel19.setText("DETALLE");
        jLabel19.setName("jLabel19"); // NOI18N

        jButton3.setText("Pagar e Imprimir Factura");
        jButton3.setName("jButton3"); // NOI18N

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 715, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 612, Short.MAX_VALUE)
                        .addComponent(jLabel12)
                        .addGap(15, 15, 15)
                        .addComponent(jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, 138, Short.MAX_VALUE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(10, 10, 10)))
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jLabel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jLabel5, javax.swing.GroupLayout.DEFAULT_SIZE, 203, Short.MAX_VALUE))
                        .addGap(117, 117, 117)
                        .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 724, Short.MAX_VALUE)
                    .addComponent(jLabel18, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 724, Short.MAX_VALUE)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(jButton3)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jButton1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jButton2))
                    .addComponent(jLabel15, javax.swing.GroupLayout.DEFAULT_SIZE, 724, Short.MAX_VALUE)
                    .addComponent(jLabel14, javax.swing.GroupLayout.DEFAULT_SIZE, 724, Short.MAX_VALUE)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel9, javax.swing.GroupLayout.DEFAULT_SIZE, 133, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jLabel17, javax.swing.GroupLayout.PREFERRED_SIZE, 203, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(117, 117, 117)
                        .addComponent(jLabel8, javax.swing.GroupLayout.DEFAULT_SIZE, 93, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel16, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jLabel19, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 724, Short.MAX_VALUE))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel13)
                    .addComponent(jLabel12))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(5, 5, 5)
                .addComponent(jLabel18, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(jLabel6))
                .addGap(4, 4, 4)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel7)
                    .addComponent(jLabel4)
                    .addComponent(jLabel3)
                    .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel9)
                    .addComponent(jLabel17)
                    .addComponent(jLabel8)
                    .addComponent(jLabel16))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jLabel19)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 139, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 46, Short.MAX_VALUE)
                .addComponent(jLabel14)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel15, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(23, 23, 23)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButton2)
                    .addComponent(jButton1)
                    .addComponent(jButton3))
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jButton1ActionPerformed

    private void iniciarValores(){

        this.tipoCambio = new ControlTipoCambio().dameCambio();
        totalBolivianos = 0;
        totalDolares = 0;
        Fecha fecha1 = new Fecha();
        fecha = fecha1.getFechaDate();
        String fechaText = fecha1.getFechaPrincipal();

        Cliente cliente = cuenta.getCliente();
        
        jLabel5.setText(String.valueOf(cuenta.getNumeroCuenta()));
        jLabel6.setText(cliente.getNombreCliente()+" "+cliente.getApellidosCli());
        jLabel7.setText(cuenta.getPlan().getNombrePlan());
        jLabel13.setText(String.valueOf(tipoCambio.getTipoCompra()));
        jLabel17.setText(String.valueOf(Herramienta.redondearDoubleString(cuenta.getMonto()))+" $us");
      
        jLabel16.setText(fechaText);
        pagosDisponibles = cuenta.getPagosDisponibles();
        double subtotalBs = 0.0;
        double subTotalSus = 0.0;
        int numPagos = pagosDisponibles.size();
        detalle = "";

        DefaultTableCellRenderer tcr = new DefaultTableCellRenderer();
        tcr.setHorizontalAlignment(SwingConstants.RIGHT);
        DefaultTableCellRenderer tcrc = new DefaultTableCellRenderer();
        tcrc.setHorizontalAlignment(SwingConstants.CENTER);

        if(Bienvenida.user.getPermiso()){
            modelo_pagos = new MiModelo(new Object [][] {},new String [] {"Detalle","Monto $us", "Monto Bs","Real en $us al "+Herramienta.redondearDoubleString(cuenta.getCodigoCuenta())+" %", "Real en Bs al "+Herramienta.redondearDoubleString(cuenta.getCodigoCuenta())+" %"}, -1);
            if(numPagos > 0){
                double subTotalRsus = cuenta.calcularMontoPago1();
                double subTotalRBs = subTotalRsus * tipoCambio.getTipoCompra();
                for(int i=0;i<numPagos;i++){
                    subTotalSus = pagosDisponibles.get(i).getMonto();
                    subtotalBs = subTotalSus * tipoCambio.getTipoCompra();
                    String d = " Pago "+pagosDisponibles.get(i).getNumeroPago()+"º Cuota de Interes TOTAL = "+Herramienta.redondearDoubleString(subtotalBs);
                    Object [] auxPago = {
                        d,
                        Herramienta.redondearDoubleString(subTotalSus),
                        Herramienta.redondearDoubleString(subtotalBs),
                        Herramienta.redondearDoubleString(subTotalRsus),
                        Herramienta.redondearDoubleString(subTotalRBs)
                    };
                    totalBolivianos = totalBolivianos + subtotalBs;
                    totalDolares = totalDolares + pagosDisponibles.get(i).getMonto();                    
                    modelo_pagos.addRow(auxPago);
                    detalle = detalle+d+"\n";
                }
                Object [] auxPago = {
                    "TOTALES =>",
                    "",
                    Herramienta.redondearDoubleString(totalBolivianos),
                    "",
                    Herramienta.redondearDoubleString(subTotalRBs * numPagos),
                };
                modelo_pagos.addRow(auxPago);
                pagos.setModel(modelo_pagos);
                pagos.getColumnModel().getColumn(0).setCellRenderer(tcrc);
                pagos.getColumnModel().getColumn(1).setCellRenderer(tcr);
                pagos.getColumnModel().getColumn(1).setMaxWidth(110);
                pagos.getColumnModel().getColumn(2).setCellRenderer(tcr);
                pagos.getColumnModel().getColumn(2).setMaxWidth(110);
                pagos.getColumnModel().getColumn(3).setCellRenderer(tcr);
                pagos.getColumnModel().getColumn(4).setCellRenderer(tcr);
                pagos.getColumnModel().getColumn(3).setMaxWidth(130);
                pagos.getColumnModel().getColumn(4).setMaxWidth(130);
                pagos.getColumnModel().getColumn(3).setMinWidth(130);
                pagos.getColumnModel().getColumn(4).setMinWidth(130);
            }
        }

        else{
            modelo_pagos = new MiModelo(new Object [][] {},new String [] {"Detalle","Monto $us", "Monto Bs"}, -1);
            if(numPagos > 0){
                for(int i=0;i<numPagos;i++){
                    subTotalSus = pagosDisponibles.get(i).getMonto();
                    subtotalBs = subTotalSus * tipoCambio.getTipoCompra();
                    String d = " Pago "+pagosDisponibles.get(i).getNumeroPago()+"º Cuota de Interes TOTAL = "+Herramienta.redondearDoubleString(subtotalBs);
                    Object [] auxPago = {
                        d,
                        Herramienta.redondearDoubleString(subTotalSus),
                        Herramienta.redondearDoubleString(subtotalBs)
                    };
                    totalBolivianos = totalBolivianos + subtotalBs;
                    totalDolares = totalDolares + subTotalSus;
                    modelo_pagos.addRow(auxPago);
                    detalle = detalle+d+"\n";
                }
                Object [] auxPago = {
                    "TOTALES =>",
                    Herramienta.redondearDoubleString(totalDolares),
                    Herramienta.redondearDoubleString(totalBolivianos)
                };
                modelo_pagos.addRow(auxPago);
                pagos.setModel(modelo_pagos);
                pagos.getColumnModel().getColumn(0).setCellRenderer(tcrc);
        pagos.getColumnModel().getColumn(1).setCellRenderer(tcr);
        pagos.getColumnModel().getColumn(1).setMaxWidth(110);
        pagos.getColumnModel().getColumn(2).setCellRenderer(tcr);
        pagos.getColumnModel().getColumn(2).setMaxWidth(110);
            }
        }
        
    }
    private void addEventos(final javax.swing.JDialog padre){
        
/// guardar e imprimir
        jButton1.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                Recibo recibo = guardar();
                if( recibo != null){
                    JOptionPane.showMessageDialog(null, "Se ha registrado el pago CORRECTAMENTE \n pulse ACEPTAR y se imprimira el Recibo", "Confirmación", JOptionPane.INFORMATION_MESSAGE);                 
                    dispose();
                    Reporte r = new Reporte();
                    r.ejecutarRecibo(recibo,detalle,cuenta);
                }else{
                    JOptionPane.showMessageDialog(null, "Se produjo un error al tratar de registrar el Pago", "Confirmación", JOptionPane.YES_OPTION);
                    dispose();
                    padre.setVisible(true);
                }                
            }
        });
        jButton3.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                Recibo recibo = guardar();
                if( recibo != null){
                    JOptionPane.showMessageDialog(null, "Se ha registrado el pago CORRECTAMENTE \n pulse ACEPTAR y se imprimira La Factura", "Confirmación", JOptionPane.INFORMATION_MESSAGE);
                    //imprimir
                    dispose();
                    GenerarFactura factura = new GenerarFactura(padre,true,pagosDisponibles);
                    Herramienta.centerOnScreen(factura);
                    
                    factura.setVisible(true);

                }
            }
        });
//boton salir
        jButton2.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                int res = JOptionPane.showConfirmDialog(null, "Si cierra la ventana no se registrara el pago.\n Seguro que quiere cerrar la ventana?", "Advertencia", JOptionPane.OK_CANCEL_OPTION);
                if(res ==0){
                    dispose();
                    padre.setVisible(true);
                }
            }
        });
        addWindowListener( new WindowAdapter(){
                @Override
                public void windowClosing(WindowEvent e) {
                        int res = JOptionPane.showConfirmDialog(null, "Si cierra la ventana no se registrara el pago.\n Seguro que quiere cerrar la ventana?", "Advertencia", JOptionPane.OK_CANCEL_OPTION);
                        if(res ==0){
                            dispose();
                            padre.setVisible(true);
                        }
                }
        });
    }
    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTable pagos;
    // End of variables declaration//GEN-END:variables

    private MiModelo modelo_pagos;
    private Cuenta cuenta;
    private ArrayList<Pago> pagosDisponibles;
    private String detalle;
    private double totalBolivianos;
    private double totalDolares;
    private Date fecha;
    private String modo;
    private TipoCambio tipoCambio;

    public Recibo guardar(){
        ControlRecibo control_recibo = new ControlRecibo();
        Recibo recibo = new Recibo();
            recibo.setFecha(fecha);
            recibo.setMonto(totalBolivianos);
            recibo.setTipoCambio(tipoCambio.getTipoCompra());
            recibo.setIdSucursal(Bienvenida.sucursal.getIdSucursal());
            recibo.setIdUsuario(Bienvenida.user.getIdUsuario());
            return  control_recibo.registrarReciboPago(recibo, cuenta, modo);//registrar el recibo el la base de datos                        
        }
}

